﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.BizTalk.Operations;
using DBLOG.BizTalk.BizTalkExplorerServices.Core;

namespace DBLOG.BizTalk.BizTalkExplorerServices.Entities
{
    public class BTSMessage : BTSEntityBase
    {
        private BizTalkMessage _message { get; set; }

        public MessageStatus Status { get; set; }

        public string ErrorMessage { get; set; }

        public string ErrorCode { get; set; }

        public string AdapterName { get; set; }

        public BTSMessage()
        {
        }

        internal BTSMessage(BizTalkMessage message)
        {
            this._message = message;

            this.PopulateSimpleProperties();
        }

        private void PopulateSimpleProperties()
        {
            this.ID = this._message.MessageID;

            this.Date = this._message.CreationTime;

            this.Status = this._message.MessageStatus;

            this.ErrorCode = this._message.ErrorCode;

            this.ErrorMessage = this._message.ErrorDescription;

            this.AdapterName = this._message.AdapterName;
        }
    }
}
